package o;

import android.app.Activity;
import androidx.fragment.app.Fragment;
import com.huawei.appgallery.foundation.service.common.protocol.AppListFragmentProtocol;
import com.huawei.appgallery.foundation.service.common.protocol.request.AppListFragmentRequest;
import com.huawei.appgallery.search.ui.HotWordFragmentProtocol;
import com.huawei.appgallery.search.ui.SearchResultFragmentProtocol;
import com.huawei.appgallery.search.ui.SearchResultFragmentProtocol.Request;
import com.huawei.hwid.core.constants.HwAccountConstants;
import java.util.List;

public class cve extends cha {
    private String ˎ;
    private AppListFragmentProtocol ˏ;
    private AppListFragmentRequest ॱ;

    public cve(Activity activity, FragmentManager juVar, List<dgp> list, AppListFragmentRequest appListFragmentRequest) {
        super(activity, juVar, list);
        this.ॱ = appListFragmentRequest;
    }

    public Fragment getItem(int i) {
        Fragment fragment;
        if (CollectCheck.isEmpty(ॱ()) || this.ॱ == null) {
            cux.ˏ.ˊ("SearchTabListPagerAdapter", "getItem, tabItemList: " + (ॱ() == null ? HwAccountConstants.NULL : Integer.valueOf(ॱ().size())));
            fragment = null;
        } else {
            dgp o_dgp = (dgp) ॱ().get(i);
            if (o_dgp == null || !ॱ(this.ॱ)) {
                cux.ˏ.ˊ("SearchTabListPagerAdapter", o_dgp == null ? "tabItem == null." : " couldn't init special page.");
                fragment = null;
            } else {
                this.ॱ.ˋ(o_dgp.ˏ());
                this.ॱ.ˊ(o_dgp.ˋ());
                this.ॱ.ॱ(i);
                this.ॱ.ˏ(chb.SECONDARY_LIST_TAB);
                this.ॱ.ॱॱ(false);
                this.ॱ.ॱॱ(o_dgp.ˊ());
                this.ˏ.ˏ(this.ॱ);
                cjm o_cjm = new cjm(this.ˎ, this.ˏ);
                if (o_cjm != null) {
                    fragment = cjk.ˎ().ˊ(o_cjm);
                } else {
                    cux.ˏ.ˊ("SearchTabListPagerAdapter", "getItem, offer == null, position: " + i);
                    fragment = null;
                }
            }
        }
        if (fragment != null) {
            return fragment;
        }
        fragment = new Fragment();
        cux.ˏ.ˊ("SearchTabListPagerAdapter", "getItem, ft == null, position: " + i);
        return fragment;
    }

    private boolean ॱ(AppListFragmentRequest appListFragmentRequest) {
        if (appListFragmentRequest instanceof Request) {
            this.ˏ = new SearchResultFragmentProtocol();
            this.ˎ = "BaseResultAppList";
            return true;
        } else if (appListFragmentRequest instanceof HotWordFragmentProtocol.Request) {
            this.ˏ = new HotWordFragmentProtocol();
            this.ˎ = "BaseHotSearch";
            return true;
        } else {
            this.ˏ = null;
            this.ˎ = null;
            cux.ˏ.ˏ("SearchTabListPagerAdapter", "the mRequest is not instanceof special.");
            return false;
        }
    }
}
